package net.wds.ssbus.modules.dbconfig.controller;

import java.util.Arrays;
import java.util.Map;

import net.wds.ssbus.common.utils.PageUtils;
import net.wds.ssbus.common.utils.R;
import net.wds.ssbus.modules.dbconfig.entity.TbDbSourceConfigEntity;
import net.wds.ssbus.modules.dbconfig.service.TbDbSourceConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;




/**
 *  
 *
 * @author qsg
 * @email qsg@wdsrouce
 * @date 2020-10-22 11:41:56
 */
@RestController
@RequestMapping("dbconfig/tbdbsourceconfig")
public class TbDbSourceConfigController {
    @Autowired
    private TbDbSourceConfigService tbDbSourceConfigService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("ssbus:tbdbsourceconfig:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbDbSourceConfigService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("ssbus:tbdbsourceconfig:info")
    public R info(@PathVariable("id") Integer id){
		TbDbSourceConfigEntity tbDbSourceConfig = tbDbSourceConfigService.getById(id);

        return R.ok().put("tbDbSourceConfig", tbDbSourceConfig);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("ssbus:tbdbsourceconfig:save")
    public R save(@RequestBody TbDbSourceConfigEntity tbDbSourceConfig){
		tbDbSourceConfigService.save(tbDbSourceConfig);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("ssbus:tbdbsourceconfig:update")
    public R update(@RequestBody TbDbSourceConfigEntity tbDbSourceConfig){
		tbDbSourceConfigService.updateById(tbDbSourceConfig);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("ssbus:tbdbsourceconfig:delete")
    public R delete(@RequestBody Integer[] ids){
		tbDbSourceConfigService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
